#include <iostream>
using namespace std;

const int maxn = 1e8+1000;

int f(int n){
    if(n<2)    return false;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

signed main()
{
    int n;
    cin>>n;
    if(f(n)){
        if(f(n-6)){
            cout<<"Yes\n"<<n-6;return 0;
        }
        if(f(n+6)){
            cout<<"Yes\n"<<n+6;return 0;
        }
    }
    cout<<"No\n";
    for(;n<maxn;n++){
        if(f(n)&&(f(n-6)||f(n+6))){
            cout<<n<<"\n";
            break;
        }
    }
    return 0;
}
